#ifndef _BUOLA_CHART_CLEGEND_H_
#define _BUOLA_CHART_CLEGEND_H_

#include <buola/chart/cxychart.h>
#include <buola/chart/cplot.h>

namespace buola { namespace chart {

class CLegend : public UShared
{
public:
    struct SItem
    {
        PPlot mPlot;
        std::wstring mText;
        img::CColor mColor;
        CPoint_d mPos;
        CPlot::EStyle mStyle;
    };

public:
    CLegend();
    virtual ~CLegend();
    
public:
///\name drawing process
//@{
    //!draws the axis to the GC
    void Draw(img::CGC *pGC,const CRect_d &pRect,PPlot pHL=nullptr);
//@}

    bool Contains(const CPoint_d &pPoint);
    PPlot HitTest(const CPoint_d &pPoint);

    void AddItem(const SItem &pItem);
    void ClearItems();    

private:
    std::vector<std::unique_ptr<SItem>> mItems;

    CRect_d mRect;
};

/*namespace chart*/ } /*namespace buola*/ }

#endif
